/*    */ package com.chw.admin.materiel;
/*    */ 
/*    */ import com.chw.annotation.PermissionSecurity;
/*    */ import com.chw.common.ServiceData;
/*    */ import com.chw.common.ServiceData.RetCode;
/*    */ import com.github.pagehelper.PageInfo;
/*    */ import com.google.gson.Gson;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ import org.springframework.web.bind.annotation.ResponseBody;
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"/chwMateriel"})
/*    */ public class ChwMaterielController
/*    */ {
/*    */ 
/*    */   @Autowired
/*    */   private IChwMaterielService chwMaterielService;
/*    */ 
/*    */   @RequestMapping(value={"/findchwMateriel.do"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   @PermissionSecurity(name="查询", module="物料管理", btnfunc="chw_Materiel")
/*    */   public ServiceData find(HttpServletRequest request, ChwMateriel chwMateriel, Integer currentPage, Integer pageSize)
/*    */     throws Exception
/*    */   {
/* 31 */     ServiceData ret = new ServiceData();
/*    */ 
/* 33 */     PageInfo chw = this.chwMaterielService.find(chwMateriel, currentPage, pageSize);
/* 34 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 35 */     ret.setBo(chw);
/* 36 */     return ret;
/*    */   }
/* 44 */   @RequestMapping(value={"/saveChwMateriel.do"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   @PermissionSecurity(name="新增", module="新增物料管理", btnfunc="add_Materiel")
/*    */   public ServiceData add(HttpServletRequest request, String param) throws Exception { ServiceData ret = new ServiceData();
/* 45 */     Gson gson = new Gson();
/* 46 */     ChwMateriel chwMateriel = (ChwMateriel)gson.fromJson(param, ChwMateriel.class);
/*    */ 
/* 48 */     int i = this.chwMaterielService.save(chwMateriel);
/* 49 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 50 */     ret.setBo(Integer.valueOf(i));
/* 51 */     return ret; } 
/*    */   @RequestMapping(value={"/updateChwMateriel.do"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   @PermissionSecurity(name="修改", module="修改物料管理", btnfunc="update_Materiel")
/*    */   public ServiceData update(HttpServletRequest request, String param) throws Exception {
/* 59 */     ServiceData ret = new ServiceData();
/* 60 */     Gson gson = new Gson();
/* 61 */     ChwMateriel chwMateriel = (ChwMateriel)gson.fromJson(param, ChwMateriel.class);
/*    */ 
/* 63 */     int i = this.chwMaterielService.update(chwMateriel);
/* 64 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 65 */     ret.setBo(Integer.valueOf(i));
/* 66 */     return ret;
/*    */   }
/* 74 */   @RequestMapping(value={"/delChwMateriel.do"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   @PermissionSecurity(name="删除", module="删除物料管理", btnfunc="del_Materiel")
/*    */   public ServiceData del(HttpServletRequest request, String id, HttpServletResponse response) throws Exception { ServiceData ret = new ServiceData();
/*    */ 
/* 76 */     int i = this.chwMaterielService.delVendor(id);
/* 77 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 78 */     ret.setBo(Integer.valueOf(i));
/* 79 */     return ret; }
/*    */ 
/*    */   @RequestMapping(value={"/findChwMaterielById.notPermSc"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   public ServiceData findById(HttpServletRequest request, String id) throws Exception
/*    */   {
/* 87 */     ServiceData ret = new ServiceData();
/*    */ 
/* 89 */     ChwMateriel rta = this.chwMaterielService.findById(id);
/* 90 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 91 */     ret.setBo(rta);
/* 92 */     return ret;
/*    */   }
/*    */ }

/* Location:           E:\chenya\haha\admin java\materiel\
 * Qualified Name:     com.chw.admin.materiel.ChwMaterielController
 * JD-Core Version:    0.6.0
 */